package com.calvin.study;

import org.springframework.beans.factory.FactoryBean;

import cn.hutool.core.util.IdUtil;
import spring.framework.study.entity.Order;

public class OrderFactoryBean implements FactoryBean<Order> {
	
	private Order order;
	
	public OrderFactoryBean() {
	}

	@Override
	public Order getObject() throws Exception {
		if(null == order) {
			order = new Order();
			order.setOrderId(IdUtil.getSnowflakeNextIdStr());
			order.setOrderName("商品");
		}
		return order;
	}

	@Override
	public Class<?> getObjectType() {
		// TODO Auto-generated method stub
		return null;
	}
}
